home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-08-13 | 1.7 KB | 110 lines | [TEXT/MPS ] |
- # Macro.set, by Alain Birtz
-
- ##################################################
-
- linkageArea equ 24
- params equ 32
- CALL_STK_SZ equ linkageArea+params
-
- DEBUG_MAC equ $7F810808 # Mac OS debug instruction (tw lt_gt_eq,r1,r1)
- DEBUG_1ST equ $04000000 # first debug instruction
- BRK_1ST equ DEBUG_1ST+16 # first break point instruction
-
- ##################################################
-
- MACRO
- MAC_OS &OSname
-
- import .&OSname
-
- mflr r0
- stwu r0,-4(sp) # save LR
- stwu sp,-CALL_STK_SZ(sp) # stack space needed for cross-TOC call
- bl .&OSname
- nop # the linker change 'nop' for 'lwz rtoc,$14(sp)'
- lwz r0,CALL_STK_SZ(sp)
- mtlr r0 # restore LR
- addi sp,sp,4+CALL_STK_SZ # clean stack
-
- ENDM
-
- ##################################################
-
- MACRO
- CALL &CALLname
-
- import .&CALLname
-
- mflr r0
- stwu r0,-4(sp) # save LR
- stwu sp,-CALL_STK_SZ(sp) # stack space needed for cross-TOC call
- bl .&CALLname
- nop # the linker change 'nop' for 'lwz rtoc,$14(sp)'
- lwz r0,CALL_STK_SZ(sp)
- mtlr r0 # restore LR
- addi sp,sp,4+CALL_STK_SZ # clean stack
-
- ENDM
-
- ###################
-
- MACRO
- JSR &subroutine
-
- mflr r0
- stwu r0,-4(sp) # save LR
- bl &subroutine # jump to subroutine
- lwz r0,0(sp)
- addi sp,sp,4
- mtlr r0 # restore LR
-
- ENDM
-
- ###################
-
- MACRO
- _Debugger
-
- dc.l DEBUG_1ST # illegal intruction
-
- ENDM
-
- ###################
-
- MACRO
- _DebugStr
-
- dc.l DEBUG_1ST+1 # illegal intruction
-
- ENDM
-
- ###################
-
- MACRO
- _DebugNum
-
- dc.l DEBUG_1ST+2 # illegal intruction
-
- ENDM
-
- ###################
-
- MACRO
- MacDebugger
-
- dc.l DEBUG_MAC # tw lt_gt_eq,r1,r1
-
- ENDM
-
- ###################
-
- MACRO
- MacDebugStr
-
- dc.l DEBUG_MAC # tw lt_gt_eq,r1,r1
-
- ENDM
-
- ##################################################
-
-